package org.grow.authfilter.entity;

import lombok.Data;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.userdetails.UserDetails;

import java.time.LocalDateTime;
import java.util.Collection;
import java.util.List;

/**
 * @Author: xwg
 * @CreateDate: 21-7-15
 */

@Data
public class UserInfo implements UserDetails {
    private Integer userId;
    private String username;

    private String password ="";
    private String nickname = "";
    private Boolean isEnable = true;
    private LocalDateTime lastLoginTime ;
    private List<RoleInfo> authorities;

    @Override
    public Collection<? extends GrantedAuthority> getAuthorities() {
        return authorities;
    }

    @Override
    public boolean isAccountNonExpired() {
        return true;
    }

    @Override
    public boolean isAccountNonLocked() {
        return true;
    }

    @Override
    public boolean isCredentialsNonExpired() {
        return true;
    }

    @Override
    public boolean isEnabled() {
        return isEnable;
    }
}
